﻿//
// DotNetNuke® - http://www.dotnetnuke.com
// Copyright (c) 2002-2012
// by DotNetNuke Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation 
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and 
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions 
// of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
// DEALINGS IN THE SOFTWARE.
//

using System;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Content;

namespace DotNetNuke.Modules.Contest.Components.Entities
{

	/// <summary>
	/// This is our Info class that represents columns in our data store that are associated with the Contest_Entry table.
	/// </summary>
	public class EntryInfo : ContentItem
	{

		#region Public Properties

		public int ContestEntryId { get; set; }
		public string EntryName { get; set; }
		public string Description { get; set; }
		public string AuthorName { get; set; }
		public int SortOrder { get; set; }
		public bool Active { get; set; }
		public bool PermitVoting { get; set; }
		public string SmallImageUrl { get; set; }
		public string LargeImageUrl { get; set; }
		public string DemoUrl { get; set; }
		public string DownloadUrl { get; set; }
		public int ModuleId { get; set; }
		public int CreatedByUserId { get; set; }
		public DateTime CreatedOnDate { get; set; }
		public int LastModifiedByUserId { get; set; }
		public DateTime LastModifiedOnDate { get; set; }
		public string AuthorUrl { get; set; }
		public bool EnableDownload { get; set; }
		public string Category { get; set; }

		// this is pulled in retrieval sprocs, not stored as an actual column
		public int TotalRecords { get; set; }

		#endregion

		#region IHydratable Implementation

		/// <summary>
		/// 
		/// </summary>
		/// <param name="dr"></param>
		public override void Fill(System.Data.IDataReader dr)
		{
			//Call the base classes fill method to populate base class proeprties
			base.FillInternal(dr);

			ContestEntryId = Null.SetNullInteger(dr["ContestEntryId"]);
			EntryName = Null.SetNullString(dr["EntryName"]);
			Description = Null.SetNullString(dr["Description"]);
			AuthorName = Null.SetNullString(dr["AuthorName"]);
			SortOrder = Null.SetNullInteger(dr["SortOrder"]);
			Active = Null.SetNullBoolean(dr["Active"]);
			PermitVoting = Null.SetNullBoolean(dr["PermitVoting"]);
			SmallImageUrl = Null.SetNullString(dr["SmallImageUrl"]);
			LargeImageUrl = Null.SetNullString(dr["LargeImageUrl"]);
			DemoUrl = Null.SetNullString(dr["DemoUrl"]);
			DownloadUrl = Null.SetNullString(dr["DownloadUrl"]);
			ModuleId = Null.SetNullInteger(dr["ModuleId"]);
			CreatedByUserId = Null.SetNullInteger(dr["CreatedByUserId"]);
			CreatedOnDate = Null.SetNullDateTime(dr["CreatedOnDate"]);
			LastModifiedByUserId = Null.SetNullInteger(dr["LastModifiedByUserId"]);
			LastModifiedOnDate = Null.SetNullDateTime(dr["LastModifiedOnDate"]);
			AuthorUrl = Null.SetNullString(dr["AuthorUrl"]);
			EnableDownload = Null.SetNullBoolean(dr["EnableDownload"]);
			Category = Null.SetNullString(dr["Category"]);
			//TotalRecords = Null.SetNullInteger(dr["TotalRecords"]);
		}

		/// <summary>
		/// Gets and sets the Key ID
		/// </summary>
		/// <returns>An Integer</returns>
		public override int KeyID
		{
			get { return ContestEntryId; }
			set { ContestEntryId = value; }
		}

		#endregion

	}
}